package com.example.project.projectspringcloud.service.order;

import com.example.project.projectspringcloud.entity.order.Order;
import com.example.project.projectspringcloud.entity.user.UserProfile;
import org.springframework.ui.Model;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Map;
import java.util.SortedMap;

/**
 * 微信常规回复设置service
 *
 * @author Administrator
 */
public interface WeChatPayService {

    /**
     * 微信支付请求(扫码支付)
     * ==============================================================================
     *
     * @param requestId
     * @param type
     * @return
     */
    String getWxpayUrl(String requestId, String type) throws Exception;


    /**
     * 微信预支付请求参数
     * ==============================================================================
     *
     * @param description 商品描述
     * @param requestId
     * @param productId 商品no
     * @param amount
     * @param userId
     * @param reqIp
     * @param url
     * @param websitemap
     * @param openid     公众号支付 用户关注的openid
     * @param tradeType 交易类型 JSAPI--公众号支付、NATIVE--原生扫码支付、APP--app支付
     * @return
     */
    SortedMap<String, String> createPackage(String description, String requestId, String productId,
                                            BigDecimal amount, Integer userId, String reqIp,
                                            String url, Map<String, String> websitemap,
                                            String openid, String tradeType, HttpServletRequest request);

    /**
     * 获取微信 密钥
     * ==============================================================================
     *
     * @return
     */
    Map<String, String> getWechatPayInfo() throws Exception;

    /**
     * 微信公众号支付请求(jspi支付) 发送预支付订单返回参数
     * ==============================================================================
     *
     * @param trxOrder
     * @param userProfile
     * @param totalFee   实际金额 总金额减掉账户金额
     * @return
     * @throws Exception
     */
    Model JSAPI(HttpServletRequest httpServletRequest, Order trxOrder,
                UserProfile userProfile, String totalFee)
            throws Exception;

    String h5API(Order order, HttpServletRequest request) throws Exception;
}


